# accounts/models.py
from django.db import models
from django.contrib.auth.models import User

class User(models.Model):
    username = models.CharField(max_length=100, unique=True)  # 用户名
    password = models.CharField(max_length=100)  # 密码
    name=models.CharField(max_length=255) # 名字
    height = models.FloatField()  # 身高
    weight = models.FloatField()  # 体重
    age = models.IntegerField()  # 年龄
    GENDER_CHOICES = [
        ('M', 'Male'),
        ('F', 'Female'),
        ('O', 'Other'),
    ]
    gender = models.CharField(max_length=255, choices=GENDER_CHOICES, default='M') # 性别

    def __str__(self):
        return self.username


class Pose(models.Model):
    user = models.ForeignKey(User, related_name='poses', on_delete=models.CASCADE)  # 用户与姿态的关系
    image_path = models.CharField(max_length=255)  # 姿态图片路径

    def __str__(self):
        return f"{self.user.username} - Pose"

class Clothing(models.Model):
    user = models.ForeignKey(User, related_name='clothes', on_delete=models.CASCADE)  # 用户与衣服的关系
    image_path = models.CharField(max_length=255)  # 衣服图片路径

    def __str__(self):
        return f"{self.user.username} - Clothing"

# models.py


class Face(models.Model):
    user = models.ForeignKey(User, related_name='faces', on_delete=models.CASCADE)
    image_path = models.CharField(max_length=255)

    def __str__(self):
        return f"Face image for {self.user.username}"
